<?php
namespace Hive\Company\Address;
/**
 * Company Address Link Table
 * 
 * To maintain the link between companies and addresses
 * 
 * @package Hive\Company\Address\Link
 * @author 
 * @license 
 * 
 * @property int	$compid		Company Unique Id
 * @property int	$adrid		Address Unique Id
 * @property int	$type		Type 
 */
class Link extends \Fox\Object {
	
	/**
	 * Link to company
	 * @var string
	 */
	const LINK_COMPANY = 'company';
	
	/**
	 * Link to company
	 * @var string
	 */
	const LINK_COMPANY_REVERSE = 'companyReverse';
		
	/**
	 * Link to real address object
	 * @var string
	 */
	const LINK_ADDRESS = 'address';
	
	/**
	 * Reverse link from address object
	 * @var string
	 */
	const LINK_COMPANY_ADDRESS = 'companyAddress';
}
\Fox\Dao::infos(Link::className(),new \Fox\Object\Info('company_addresses', \Fox\Databases::DB_APP));
// Link To Real Address
\Fox\Object\Links::add(\Fox\Dao::link(Link::className(), Link::LINK_ADDRESS)
	->to(\Fox\Common\Address::className(),Link::LINK_COMPANY_ADDRESS)
	->on('adrid')
	->oneToOne()
	->versionFrom()
);